<!DOCTYPE html>
<html>
<head>
	<meta charset="utf-8">
	<meta name="viewport" content="width=device-width, initial-scale=1">
	<title></title>
	<style type="text/css">
		*{
			margin: 0;
			padding: 0;
		}
		.one{
			width: 200px;
			height: 200px;
			background-color: red;
			position: absolute;
			left: 50%;
			z-index: 1;
			margin-left:-100px ;

		}
		.two{
			width: 300px;
			height: 300px;
			background-color: green;
			position: absolute;
			left: 50%;
			z-index: 2;
/*			前提是有定位 无定法单独使用*/
/*			控制元素的额堆叠顺序  数字小的在下面*/
			margin-left: -150px;
		}
		.model{
			position: absolute;
			left: 0;
			right: 0;
			bottom: 0;
			top: 0;
			background-color: rgb(0, 0, 0, 0.5);
/*			opacity: 1;*/
/*			opacity: ;  影响后代元素 同时跟着透明*/
/*			rgba 设置谁透明 不会影响其他元素*/


/*			0-255  三原色范围*/
		}
		.box{
			width: 300px;
			height: 240px;
			background-color: white;
			border-radius: 8px;
			position: absolute;
			left: 50%;
			top: 20%;
			margin-left: -150px;
		}
	</style>
</head>
<body>
	<!-- 遮罩层 -->
	<div class="model">
		<!-- 模态框   对话框-->
		<div class="box"></div>
	</div>
	<img src="../小猫.jpg">
	<img src="../小猫.jpg">
	<img src="../小猫.jpg">

	<!-- <div class="one"></div>
	<span class="two"></span> -->
</body>
</html>